package com.dianzhang.xsentinel.service;

import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.stereotype.Service;

/**
 * @author xingyulai
 * @date 2024/2/24 3:47 PM
 * @description
 **/
@Service
public class BusinessService {

    public void work (){

        try (Entry entry = SphU.entry("test")) {
            // do something here (your business logic)...
            System.out.println("可以执行");
        } catch (BlockException ex) {
            // Here to handle the rejection
            System.out.println("不可以执行");

        }

    }


}
